package com.wxd.test.log;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"})
public class LogbackDemo {
	private static Logger logger = LoggerFactory.getLogger(LogbackDemo.class);
	
	@Test
	public void test(){
		logger.trace("======trace");  
		logger.debug("======debug");  
		logger.info("======info");  
		logger.warn("======warn");  
		logger.error("======error");  
           
        String name = "Aub";  
        String message = "3Q";  
        String[] fruits = { "apple", "banana" };  
          
        // logback提供的可以使用变量的打印方式，结果为"Hello,Aub!"  
        logger.info("Hello,{}!", name);  
          
        // 可以有多个参数,结果为“Hello,Aub! 3Q!”  
        logger.info("Hello,{}!   {}!", name, message);  
          
        // 可以传入一个数组，结果为"Fruit:  apple,banana"  
        logger.info("Fruit:  {},{}", fruits); 
	}
}
